package com.ds.infrastructure.hyperspace.console.model.response.diagram;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.LongSummaryStatistics;
import java.util.Map;

/**
 * 双折线图
 * https://antv.alipay.com/zh-cn/g2/3.x/demo/line/series.html
 *
 * @author: yaozhendong
 * @create: 2019-11-01 10:48
 **/
@Data
@NoArgsConstructor
public class SeriesChart {

    private Long xAxis;
    private Long yAxis;
    private String tag;

    public static SeriesChart toVO(Map.Entry<Long, LongSummaryStatistics> entry, String tag) {
        SeriesChart seriesChart = new SeriesChart();
        seriesChart.setXAxis(entry.getKey());
        seriesChart.setYAxis(entry.getValue().getSum());
        seriesChart.setTag(tag);
        return seriesChart;
    }

}
